<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
</head>
<body>
<nav class="navbar " style="margin-top: -1px;margin-left:-1px;">
    <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <a id="name_lab1" class="navbar-brand" href="#" style="font-size: 13px;font-weight:bold;color: white;"></a>
    </div>
    <div class="collapse navbar-collapse" style="border-radius: 0 5px 5px 0;background-color: #4d7496;color: white;"
         id="bs-example-navbar-collapse-1">
        <ul class="navbar-nav navbar-right">
            <li style="padding: 15px 20px;border-left: 1px solid #9dc4ff;" class="dropdown">
                <a style="text-decoration:none;color: white;" href="#" class="dropdown-toggle" data-toggle="dropdown"
                   role="button" aria-haspopup="true" aria-expanded="false"><span class="caret"></span><span id="name_lab2"></span></a>
                <ul class="dropdown-menu">
                    <li><a href="#"><span class="glyphicon glyphicon-user"></span>&nbsp;&nbsp;个人主页</a></li>
                    <li role="separator" class="divider"></li>
                    <li><a href="${applicationScope.basePath}/home" target="_blank"><span class="glyphicon glyphicon-screenshot"></span>&nbsp;&nbsp;前台首页</a></li>
                </ul>
            </li>
            <li style="padding: 15px 20px;border-left: 1px solid #9dc4ff;border-right: 1px solid #9dc4ff;margin-right: 20px;">
                <a id="exit" style="text-decoration:none;color: white;" href="#"><span class="glyphicon glyphicon-off"></span>&nbsp;&nbsp;安全退出</a>
            </li>
        </ul>
    </div>
</nav>
</body>

<script>
    $(function () {
        $.ajax({
            url: "${applicationScope.basePath}/admin/activeUser",
            type: "POST",
            dataType: "json",
            contentType: "application/json;charset=UTF-8",
            success: function (data) {
                $("#name_lab1").text("欢迎，" + data['username']);
                $("#name_lab2").text(data['username']);
            }
        });

        /*退出*/
        $("#exit").on("click",function () {
            if(confirm("确定退出吗？")){
                location.href = " ${applicationScope.basePath}/admin/exit";
            }
            return false;
        });
    });
</script>
</html>
